package appconfig

import (
	"github.com/spf13/viper"
	"log"
)

type Appconf struct {
	Mysql
	Redis
}
type Mysql struct {
	User     string
	Pass     string
	Host     string
	Port     int
	Database string
}
type Redis struct {
	Host string
	Port int
	Pass string
}

var Config Appconf

func Init() {

	viper.SetConfigFile("appconfig/config.yaml")

	viper.ReadInConfig()

	viper.Unmarshal(&Config)

	log.Println("获取成功", Config)
}
